package xixirupan.tmgp.tencent.com.vmeim.ui.mine.model;

import android.util.Log;

import java.util.ArrayList;
import java.util.List;

import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;
import retrofit2.Retrofit;
import retrofit2.converter.gson.GsonConverterFactory;
import xixirupan.tmgp.tencent.com.vmeim.config.URLConfig;
import xixirupan.tmgp.tencent.com.vmeim.retrofit.IMineR;

/**
 * Created by lenovo on 2016/10/20.
 */

public class MinDataBiz {
    IMineData post;
    public  void getMineData(final IMineData post)
    {
        this.post =post;

        Retrofit retrofit =new Retrofit.Builder()
                .baseUrl(URLConfig.Url.BASE_URL)
                .addConverterFactory(GsonConverterFactory.create())
                .build();
        IMineR iMineR = retrofit.create(IMineR.class);
        Call<MineBean> minData = iMineR.getMinData();
        minData.enqueue(new Callback<MineBean>() {
            @Override
            public void onResponse(Call<MineBean> call, Response<MineBean> response) {
                MineBean body = response.body();
                DataBaen data = body.getData();
                List<UserCenterBannersBaen> userCenterBanners = data.getUserCenterBanners();
                post.postMinData(userCenterBanners);


            }

            @Override
            public void onFailure(Call<MineBean> call, Throwable t) {
                Log.i("TAG","_------------>我的界面鸡西数据失败"+t.getMessage());
            }
        });
    }
}
